From bf771f183a6d31e7b4b98bbda804da0fa7263579 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Wed, 23 Mar 2005 13:43:21 +0000 Subject: [PATCH] bitkeeper revision 1.1236.1.118 (42417279HPSjyqvMU1nR51tWeAILpw) Fix x86/64 build. Signed-off-by: Keir Fraser --- xen/arch/x86/domain.c | 2 ++ xen/arch/x86/traps.c | 26 ++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index db2efe8a86..906da39dea 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -733,7 +733,9 @@ long do_switch_to_user(void) void context_switch(struct exec_domain *prev_p, struct exec_domain *next_p) { +#ifdef __i386__ struct tss_struct *tss = init_tss + smp_processor_id(); +#endif execution_context_t *stack_ec = get_execution_context(); __cli(); diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index d5ef2052f9..f06e9991ed 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -385,12 +385,27 @@ static inline int guest_io_okay( struct exec_domain *ed, struct xen_regs *regs) { u16 x; +#if defined(__x86_64__) + /* If in user mode, switch to kernel mode just to read I/O bitmap. */ + extern void toggle_guest_mode(struct exec_domain *); + int user_mode = !(ed->arch.flags & TF_kernel_mode); +#define TOGGLE_MODE() if ( user_mode ) toggle_guest_mode(ed) +#elif defined(__i386__) +#define TOGGLE_MODE() ((void)0) +#endif + if ( ed->arch.iopl >= (KERNEL_MODE(ed, regs) ? 1 : 3) ) return 1; - if ( (ed->arch.iobmp_limit > (port + bytes)) && - (__get_user(x, (u16 *)(ed->arch.iobmp+(port>>3))) == 0) && - ((x & (((1<arch.iobmp_limit > (port + bytes) ) + { + TOGGLE_MODE(); + __get_user(x, (u16 *)(ed->arch.iobmp+(port>>3))); + TOGGLE_MODE(); + if ( (x & (((1<domain; u16 x; + if ( IS_PRIV(d) || (d->arch.max_iopl >= (KERNEL_MODE(ed, regs) ? 1 : 3)) ) return 1; + if ( d->arch.iobmp_mask != NULL ) { x = *(u16 *)(d->arch.iobmp_mask + (port >> 3)); if ( (x & (((1<